package com.iceengine.input.mouse;

/**
 * This class manages the mouselistener and add/remove mouseevents.
 * @author penguin
 */

public class MouseManager {
    private MouseListener theListener;
    private Thread ListenerThread;
    /**
     * Start the mouselistener Thread.
     */
    public void startListener()
    {
        theListener = new MouseListener();
        ListenerThread = new Thread(theListener);
        ListenerThread.setName("Keyboard Listener Thread");
        ListenerThread.start();
    }
    /**
     * Stop the mouselistener thread.
     */
    public void stopListener()
    {
        theListener.killThread();
        ListenerThread.stop();
    }
    /**
     * Add a event to the mouselistener thread.
     * @param toAdd Event to add.
     */
    public void addEvent(IMouseEvent toAdd)
    {
        theListener.addEvent(toAdd);
    }
    /**
     * Remove a event from the mouselistener thread.
     * @param toRemove Event to remove.
     */
    public void removeEvent(IMouseEvent toRemove)
    {
        theListener.removeEvent(toRemove);
    }
}
